﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using GameFramework.Materials;

namespace GameFramework.ModelManager
{
    public abstract class AnimatedModel : ManagedModel
    {
        public AnimatedModel()
        {
        }

        public AnimatedModel(Model model, Vector3 position, Vector3 rotation,
            Vector3 scale, GraphicsDevice graphicsDevice)
            : base(model, position, rotation, scale, graphicsDevice)
        {
            if (model.Meshes[0].Effects[0].GetType() != typeof(SkinnedEffect))
                setNewEffect();
        }

        public abstract void Update(GameTime gameTime);
        protected abstract void setNewEffect();

        public virtual float PlaySpeed
        {
            get { return playSpeed; }
            set { playSpeed = value; }
        }

        public virtual IAnimationPlayer AnimationPlayer
        {
            get { return animationPlayer; }
            set { animationPlayer = value; }
        }

        /// <summary>
        /// Strategy for animation playing.
        /// </summary>
        protected IAnimationPlayer animationPlayer;
        protected float playSpeed = 1.0f;
    }
}
